"""
@author: Sergiy Tsymbalyuk
"""

import logging

from repoze.what.plugins.pylonshq import ControllerProtector
from repoze.what.predicates import has_permission

from chowa.lib.site.crud import HierarchyCrudController
from chowa.model import MenuItem, MenuTopItem, MenuSubItem

log = logging.getLogger(__name__)

__controller__ = 'MenuItemsController' 

@ControllerProtector(has_permission('site.administer.navigation'))
class MenuItemsController(HierarchyCrudController):
    __model__ = MenuItem
    __top_model__ = MenuTopItem
    __sub_model__ = MenuSubItem
    __parent_filter__ = 'parent_id'
